public class Demo
{
    private static void Sort(double[] a)
    {
        if (a == null || a.Length <= 1)
            return;

        double temp;
        for (int i = 0; i < a.Length - 1; i++)
        {
            for (int j = 0; j < a.Length - i - 1; j++)
            {
                if (a[j] < a[j + 1])
                {
                    temp = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = temp;
                }
            }
        }
    }

    public static void TestPrint(double[] array)
    {
        if (array == null)
        {
            Console.WriteLine("输入的数组为null，无法排序");
            return;
        }

        Console.WriteLine("排序前的数组：");
        PrintArray(array);
        Sort(array);
        Console.WriteLine("排序后的数组（降序）：");
        PrintArray(array);
    }

    private static void PrintArray(double[] array)
    {
        if (array.Length == 0)
        {
            Console.WriteLine("数组为空");
            return;
        }

        foreach (double num in array)
        {
            Console.Write(num + "  ");
        }

        Console.WriteLine("\n");
        ;
    }
}